package com.example.shardingjdbc.service.impl;

import com.example.shardingjdbc.mapper.MemberMapper;
import com.example.shardingjdbc.model.Member;
import com.example.shardingjdbc.service.MemberSevice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.Random;

@Service
public class MemberSeviceImpl implements MemberSevice {
    @Autowired
    MemberMapper memberMapper;


    @Override
    public Member insertMember() {
        Member member = new Member();
        int random = new Random().nextInt(100);
        member.setAccountNo("zhangsan"+random);
        member.setAge(random);
        member.setMemberName("张三"+random);
        member.setNickName("张三"+random);
        member.setDelFlag("0");
        member.setPassword("123456");
        member.setBirthDate(new Date());
        member.setUpdateTime(new Date());
        memberMapper.insert(member);
        return member;
    }

    @Override
    public Member selectMemberById(long id) {
        return null;
    }
}
